﻿@{
    ViewBag.Title = "Login";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head{
    <link rel="stylesheet" href="/content/css/pages/page_login.css" />
}

<div class="loginbg" style="min-height:440px;">
<div class="container">		
	<div class="row-fluid">
        <div class="span4 offset8 loginfrom">
            <form id="loginform" class="reg-page" style="padding:18px; margin-bottom:10px;" action="/account/login" method="post">
                <input type="hidden" name="ReturnUrl" value="@ViewBag.ReturnUrl" />
                <input type="hidden" name="token" />
                @if (!String.IsNullOrEmpty(ViewBag.Validation))
                {
                    <input type="hidden" name="reset" value="1" />
                }
                <div class="reg-header" style="margin-bottom:10px;">            
                    <h2><b>登录到融汇贷</b></h2>
                </div>
                @if (!String.IsNullOrEmpty(ViewBag.Message))
                { 
                    <div id="msg" class="alert alert-error">@ViewBag.Message</div>
                }
                <div class="input-group margin-bottom-10" style="margin-top:10px;">
                    <div style="width:60px; float:left; height:30px; line-height:30px;">用户名：</div>
                    <input type="text" name="username" id="txtusername" value="@ViewBag.Username" placeholder="请输入用户名" style="width:245px; background-color:#fff;" class="form-control" />
                </div>                    
                <div class="input-group margin-bottom-10">
                    <div style="width:60px; float:left; height:30px; line-height:30px;">密码：</div>
                    <input type="password" name="password" id="txtpwd" placeholder="请输入密码" style="width:245px; background-color:#fff;" class="form-control" />
                </div>    
                @if (!String.IsNullOrEmpty(ViewBag.Validation))
                {
                <div class="input-group margin-bottom-10">
                    <div style="width:60px; float:left; height:30px; line-height:30px;">验证码：</div>
                    <div class="input-append">
                        <input type="text" id="txtvalidator" maxlength="4" name="code" style="height:22px;" class="input-small" />
                        <span class="add-on" style="padding:0; height:30px;"><div id="codeimg"> </div></span>
                    </div>
                </div>   
                }
                <div class="input-group" style="height:35px;">
                    <span id="vdmsg" style="height:35px; line-height:35px; color:#b94a48;"></span>
                    <input type="submit" style="float:right;" class="btn-u" value="登录"/>
                </div>  
                <hr style="border-top:1px solid #ccc" />
                <p><a class="color-green" href="/account/resetpassword">点击这里</a> 找回密码 / <a class="color-green" href="/account/register">注册新用户</a></p> 
            </form>            
        </div>
    </div>
</div>	
</div>
@section scripts{
<script type="text/javascript" src="/content/scripts/plug.js"></script>
<script type="text/javascript">
    var validation = new plug.BindValidCode();
    $(function () {
        validation.BindValidator();
        $('#loginform').submit(function () {
            var username = $('#txtusername').val();
            if (username == '') {
                $('#vdmsg').text('* 请输入用户名');
                return false;
            }
            var pwd = $('#txtpwd').val();
            if (pwd == '') {
                $('#vdmsg').text('* 请输入您的密码');
                return false;
            }
            if ($('#txtvalidator').length > 0) {
                if ($('#txtvalidator').val() == '') {
                    $('#vdmsg').text('* 请输入验证码');
                    return false;
                }
            }
        });
    });
    function Refalsh(sender) {
        validation.Refalsh(sender);
    }
</script>
}